<template>
  <div>
    <!-- 面包屑导航区-->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/welcome' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>


    <el-card>
        <!-- 表格区-->
        <el-table :data="rightTableData" border >
        <el-table-column type="index" label="#" width="180"></el-table-column>
        <el-table-column prop="authName" label="权限名称" width="180" ></el-table-column>
        <el-table-column  label="权限等级"  width="180">
            <template slot-scope="scope">
                <el-tag v-if="scope.row.level === '0'">一级</el-tag>
                <el-tag type="success" v-else-if="scope.row.level === '1'">二级</el-tag>
                <el-tag type="info" v-else>三级</el-tag>
            </template>
        </el-table-column>
        <el-table-column prop="path" label="路径"  width="180"></el-table-column>
        </el-table>
    </el-card>
  </div>
</template>

<script type="text/ecmascript-6">
    import {requestRightData} from "@/network/power/right.js"
    export default {
        data() {
            return {
                rightTableData:[]
                }
        },
        created() {
            this.getRightData()
        },
        methods: {
            /*
            网络请求相关的函数
            */
            async getRightData(){
                const {data} = await requestRightData()
                if(data.meta.status !== 200) return this.$message.error('权利列表数据获取失败')
                this.rightTableData = data.data
                console.log(data);
                
            }
        },
    }
</script>

<style lang="less" scoped>
    .el-table{
        .el-table__body{
            overflow: auto;
            width: 100% !important;
        }
        
    }


</style>
